/*
*   Created by Standard Generator beta version.
*   Created Date Wed Jul 16 16:56:14 GMT+07:00 2003
*/

package com.epro.standard.usermenu;

import java.util.Vector;

import com.epro.standard.infrastructure.root.KeywordCondition;
import com.epro.standard.infrastructure.root.KeywordConstant;
import com.epro.standard.infrastructure.root.KeywordElement;
import com.epro.standard.infrastructure.root.StdKeyword;

public class UserAccount_GroupKeyword extends StdKeyword {
    public UserAccount_GroupKeyword() {
        super();
        addElement("USER_ACCOUNT", "UA", "USER_ID", "String", true);
        addElement("USER_ACCOUNT", "UA", "USER_GROUP_ID", "String", true);
        addElement("USER_ACCOUNT", "UA", "USER_NAME", "String", true);
        addElement("USER_ACCOUNT", "UA", "USER_LOGIN", "String", true);
        addElement("USER_ACCOUNT", "UA", "USER_PASSWORD", "String", true);
        addElement("USER_ACCOUNT", "UA", "USER_PROFILE", "String", true);
        addElement("USER_ACCOUNT", "UA", "IS_CHANGE_PASSWORD", "String", true);
        addElement("USER_ACCOUNT", "UA", "LOCAL_ID", "String", true);
        addElement("USER_ACCOUNT", "UA", "ROLE_ID", "String", true);
        addElement("USER_ACCOUNT", "UA", "ORG_ID", "String", true);
        addElement("USER_ACCOUNT", "UA", "ACTIVE", "String", true);
        addElement("USER_ACCOUNT", "UA", "UPD_BY", "String", true);
        addElement("USER_ACCOUNT", "UA", "UPD_DATE", "Timestamp", true);
        addElement("USER_GROUP", "UG", "USER_GROUP_ID", "String", false);
        addElement("USER_GROUP", "UG", "ROLE_ID", "String", false);
        addElement("USER_GROUP", "UG", "USER_GROUP_NAME", "String", false);
        addElement("USER_GROUP", "UG", "ACTIVE", "String", false);
        addElement("USER_GROUP", "UG", "UPD_BY", "String", false);
        addElement("USER_GROUP", "UG", "UPD_DATE", "Timestamp", false);
    }

    private void addElement(String tableName, String aliasName, 
                            String columnName, String type, boolean isMain) {
        elements.put(aliasName + "." + columnName, 
                     new KeywordElement(tableName, aliasName, columnName, type, 
                                        isMain));
    }

    public KeywordElement getUA_userID() {
        return (KeywordElement)elements.get("UA.USER_ID");
    }

    public KeywordElement getUA_userGroupID() {
        return (KeywordElement)elements.get("UA.USER_GROUP_ID");
    }

    public KeywordElement getUA_userName() {
        return (KeywordElement)elements.get("UA.USER_NAME");
    }

    public KeywordElement getUA_userLogin() {
        return (KeywordElement)elements.get("UA.USER_LOGIN");
    }

    public KeywordElement getUA_userPassword() {
        return (KeywordElement)elements.get("UA.USER_PASSWORD");
    }

    public KeywordElement getUA_userProfile() {
        return (KeywordElement)elements.get("UA.USER_PROFILE");
    }

    public KeywordElement getUA_isChangePassword() {
        return (KeywordElement)elements.get("UA.IS_CHANGE_PASSWORD");
    }

    public KeywordElement getUA_localID() {
        return (KeywordElement)elements.get("UA.LOCAL_ID");
    }

    public KeywordElement getUA_roleID() {
        return (KeywordElement)elements.get("UA.ROLE_ID");
    }

    public KeywordElement getUA_orgID() {
        return (KeywordElement)elements.get("UA.ORG_ID");
    }

    public KeywordElement getUA_active() {
        return (KeywordElement)elements.get("UA.ACTIVE");
    }

    public KeywordElement getUA_updBy() {
        return (KeywordElement)elements.get("UA.UPD_BY");
    }

    public KeywordElement getUA_updDate() {
        return (KeywordElement)elements.get("UA.UPD_DATE");
    }

    public KeywordElement getUG_userGroupID() {
        return (KeywordElement)elements.get("UG.USER_GROUP_ID");
    }

    public KeywordElement getUG_roleID() {
        return (KeywordElement)elements.get("UG.ROLE_ID");
    }

    public KeywordElement getUG_userGroupName() {
        return (KeywordElement)elements.get("UG.USER_GROUP_NAME");
    }

    public KeywordElement getUG_active() {
        return (KeywordElement)elements.get("UG.ACTIVE");
    }

    public KeywordElement getUG_updBy() {
        return (KeywordElement)elements.get("UG.UPD_BY");
    }

    public KeywordElement getUG_updDate() {
        return (KeywordElement)elements.get("UG.UPD_DATE");
    }

    public void setJoin(boolean join, boolean isPKJoin) {
        if (join) {
            isJoin = true;
            KeywordCondition c1 = 
                new KeywordCondition(getUA_userGroupID(), getUG_userGroupID(), 
                                     KeywordConstant.KEY_EQUAL, true);
            if (isPKJoin)
                mainCondition.addCondition(c1);
        } else {
            mainCondition.clearPKCondition();
            isJoin = false;
        }
    }

    public Vector getReturnVO(java.sql.ResultSet rs) {
        Vector returnVector = new Vector();
        try {
            while (rs.next()) {
                returnVector.addElement(new UserAccount_GroupVO((isColumnInResultSet("UA_USER_ID", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_USER_ID") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_USER_GROUP_ID", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_USER_GROUP_ID") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_USER_NAME", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_USER_NAME") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_USER_LOGIN", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_USER_LOGIN") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_USER_PASSWORD", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_USER_PASSWORD") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_USER_PROFILE", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_USER_PROFILE") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_IS_CHANGE_PASSWORD", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_IS_CHANGE_PASSWORD") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_LOCAL_ID", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_LOCAL_ID") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_ROLE_ID", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_ROLE_ID") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_ORG_ID", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_ORG_ID") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_ACTIVE", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_ACTIVE") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_UPD_BY", 
                                                                                     rs)) ? 
                                                                rs.getString("UA_UPD_BY") : 
                                                                null, 
                                                                (isColumnInResultSet("UA_UPD_DATE", 
                                                                                     rs)) ? 
                                                                rs.getTimestamp("UA_UPD_DATE") : 
                                                                null, 
                                                                (isColumnInResultSet("UG_ROLE_ID", 
                                                                                     rs)) ? 
                                                                rs.getString("UG_ROLE_ID") : 
                                                                null, 
                                                                (isColumnInResultSet("UG_USER_GROUP_NAME", 
                                                                                     rs)) ? 
                                                                rs.getString("UG_USER_GROUP_NAME") : 
                                                                null, 
                                                                (isColumnInResultSet("UG_ACTIVE", 
                                                                                     rs)) ? 
                                                                rs.getString("UG_ACTIVE") : 
                                                                null, 
                                                                (isColumnInResultSet("UG_UPD_BY", 
                                                                                     rs)) ? 
                                                                rs.getString("UG_UPD_BY") : 
                                                                null, 
                                                                (isColumnInResultSet("UG_UPD_DATE", 
                                                                                     rs)) ? 
                                                                rs.getTimestamp("UG_UPD_DATE") : 
                                                                null));
            }
        } catch (java.sql.SQLException sqle) {
            sqle.printStackTrace();
        }
        return returnVector;
    }

    public void addCriteria(KeywordElement ke, String value) {
        addCommonCriteria(ke, value);
    }
}
